import csv
import matplotlib.pyplot as plt
import numpy as np

example_file = open(r'C:\Users\hmd\Desktop\test\python_scripts\data.csv', 'rt', encoding='UTF-8')  # 打开csv文件
example_reader = csv.reader(example_file, delimiter=',')  # 读取csv文件
data = np.array(list(example_reader))   # csv数据转换
rows, colums = data.shape
print("rows num:", rows)
print("colums num:", colums)

x = list()
y = list()

for i in range(0, 50):  # 从第二行开始读取
  # x.append(data[i][3])  # 将第4列数据从第1行读取到最后一行赋给列表x
  x.append(i)
  y.append(data[i][5])  # 将第6列数据从第1行读取到最后一行赋给列表

# plt.plot(x, y)  # 绘制x,y的折线图
plt.scatter(x, y, c="r") # 绘制x,y的散点图
plt.scatter(x, np.sin(x), c="g")
plt.show()  # 显示折线图
